<?php
$connect = mysqli_connect('localhost','root','root','thinkcmf');
mysqli_set_charset($connect,'utf8');
if(!$connect){
    echo '数据库连接失败';
    die;
}


// 接收数据
$image = $_POST['image'];
$name = $_POST['name'];
$age = $_POST['age'];
$sex = $_POST['sex'];
$idcard = $_POST['idcard'];
$address = $_POST['address'];
$id = $_POST['id'];
$update_sql = "update cmf_student set image='$image',name='$name',age=$age,sex='$sex',idcard='$idcard',address='$address'where id = $id";

$query = mysqli_query($connect, $update_sql);


if ($query) {
    echo json_encode(['code' => 1, 'msg' => '修改成功', 'data' => []]);
} else {
    echo json_encode(['code' => 2, 'msg' => '修改失败', 'data' => []]);
}
